package com.dl.service.impl;

import com.dl.dao.StorageDao;
import com.dl.service.StorageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Slf4j
public class StorageServiceImpl implements StorageService {

    @Autowired
    private StorageDao storageDao;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int decrease(Long productId, Integer count) {
        log.info("---------------库存服务开始扣减库存---------------");
        return storageDao.decrease(productId,count);
    }
}
